layui.define(['http', 'MD5', 'qs'], function (exports) {
    var http = layui.http.service,
        qs = layui.qs,
        MD5 = layui.MD5;

    var mandyServices = {
        /*工作统计旧接口，待删除*/
        mandy_get_group_members_scheduling: function (groupId, startTime, endTime) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_time = startTime;
            dto.end_time = endTime;

            return http("/mandy/group_members_scheduling", {params: dto});
        },

        /*工作统计旧接口，待删除*/
        mandy_get_group_scheduling: function (groupId, startTime, endTime) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            return http("/mandy/group_scheduling", {params: dto});
        },

        /*工作统计旧接口，待【开发】后删除*/
        mandy_get_my_scheduling_sync: function (therapistId, startTime, endTime) {
            var dto = {};
            dto.therapist_id = therapistId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            return http("/mandy/my_scheduling", {params: dto});
        },

        /*工作统计旧接口，待【开发】后删除*/
        mandy_get_group_scheduling_sync: function (groupId, startTime, endTime) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            return http("/mandy/group_scheduling", {params: dto});
        },

        /*整理接口,2017/07/25, author:lanlan.zeng*/

        //分页查询信息
        mandy_get_my_message_by_page: function (bussTypes, isRead, pageSize, page) {
            var dto = {};
            //dto.current_page = currentPage;
            dto.page_size = pageSize;
            dto.page = page;
            dto.is_read = isRead;
            if (bussTypes != null) {
                dto.buss_types = bussTypes;
            }
            return http("/mandy/my_message_by_page", {params: dto});
        },

        //获取未读信息数
        mandy_get_my_message_unread_count: function () {
            var dto = {};
            return http("/mandy/my_message_unread_count", {params: dto});
        },

        //标记已读信息
        mandy_put_message_is_read: function (messageId) {
            var dto = {};
            dto.messageId = messageId;
            return http("/mandy/message_is_read", {method: 'put', params: dto});
        },

        //获取我的任务
        mandy_get_my_task: function (searchKey, page, page_size, status, sortType) {
            var dto = {};
            dto.current_page = page;
            dto.page_size = page_size;
            dto.status = status;
            dto.search_key = searchKey;
            dto.sort_type = sortType;
            return http("/mandy/gauge_record_by_page", {params: dto});
        },

        //完成评估量表
        mandy_post_gauge_record_result: function (gaugeRecordId, result) {
            var params = {
                gauge_record_id: gaugeRecordId
            };
            return http("/mandy/gauge_record_result", {method: 'post', params: params, data: result});
        },

        //未完成工作评估数
        mandy_get_my_task_count: function (searchKey, status) {
            var dto = {};
            dto.status = status;
            dto.search_key = searchKey;
            return http("/mandy/gauge_record_count", {params: dto});
        },

        //治疗师个人工作统计
        mandy_get_my_scheduling: function (therapistId, startTime, endTime) {
            var dto = {};
            dto.therapist_id = therapistId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            return http("/mandy/my_scheduling", {params: dto});
        },

        //工作统计明细
        mandy_get_staff_statistics: function (groupId, startTime, endTime) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            return http("/mandy/get_staff_statistics", {params: dto});
        },

        //工作统计累计
        mandy_get_staff_statistics_count: function (groupId, startTime, endTime) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            return http("/mandy/get_staff_statistics_count", {params: dto});
        },

        //增加医务人员
        mandy_add_medical_info: function (mobile, pwd, name, sex, birthday, divisionId, job, roleId, teacherId, treatmentGroupId) {
            var dto = {};
            dto.mobile = mobile;
            dto.pwd = MD5.hex_md5(pwd + "{cloud}");
            dto.name = name;
            dto.sex = sex;
            dto.birthday = birthday;
            dto.divisionId = divisionId;
            dto.job = job;
            dto.roleId = roleId;
            dto.teacherId = teacherId;
            dto.treatmentGroupId = treatmentGroupId;
            return http("/mandy/medical_info", {method: 'post', data: dto});
        },

        //查询设备类型
        mandy_get_all_device_type_syn: function () {
            var dto = {};
            return http("/mandy/get_all_type", {params: dto});
        },


        //通过设备类型查询负责人
        mandy_get_leader: function (itemTypeId) {
            var dto = {};
            dto.itemTypeId = itemTypeId;
            return http("/mandy/get_leader", {params: dto});
        },

        //通过设备类型查询项目
        mandy_get_device_project: function (typeId) {
            var dto = {};
            dto.typeId = typeId;
            return http("/mandy/get_device", {params: dto});
        },

        //添加设备(新接口)
        mandy_post_add_device_lev2: function (type_id, name, subitem_id, subitem_name, profile_id, director, treatPeople) {
            var dto = {};
            dto.type_id = type_id;
            dto.name = name;
            /*dto.subitem_id = subitem_id;*/
            dto.subitem_name = subitem_name;
            dto.profile_id = profile_id;
            dto.director = director;
            dto.treatPeople = treatPeople;

            //新接口，添加设备的同时批量添加项目关联
            dto.subitem_ids = [subitem_id];
            return http("/mandy/add_device_and_items", {method: 'post', data: dto});
        },

        //分页查询设备列表
        mandy_device_list_by_page: function (searchKey, page, pageSize) {
            var dto = {};
            dto.search_key = searchKey;
            dto.page = page;
            dto.page_size = pageSize;
            return http("/mandy/device_list_by_page", {params: dto});
        },

        //查看单条设备信息
        mandy_get_device_by_id: function (id) {
            var dto = {};
            dto.id = id;
            return http("/mandy/get_device_by_id", {params: dto});
        },


        //修改设备信息(新接口)
        mandy_update_device: function (id, treatPeople, director) {
            var dto = {};
            dto.id = id;
            dto.treatPeople = treatPeople;
            dto.director = director;
            return http("/mandy/update_device", {method: 'post', data: dto});
        },


        //获取医务人员（分页）
        mandy_get_medical_list_by_page: function (searchKey, page, pageSize, trainee) {
            var dto = {};
            dto.search_key = searchKey;
            dto.page = page;
            dto.page_size = pageSize;
            dto.trainee = trainee;
            return http("/mandy/medical_list_by_page", {params: dto});
        },

        //获取医院信息
        mandy_get_hospital: function (id) {
            var dto = {};
            dto.hospital_id = id;
            return http("/mandy/hospital", {params: dto});
        },

        //修改医务人员密码
        mandy_put_medical_pwd: function (medicalId, pwd) {
            var dto = {};
            dto.medical_id = medicalId;
            dto.pwd = MD5.hex_md5(pwd + "{cloud}");
            return http("/mandy/medical_pwd", {method: 'put', data: dto, urlencoded: true});
        },

        //启用、禁用医务人员账户
        mandy_put_medical_disabled: function (medicalId, disabled) {
            var dto = {};
            dto.medical_id = medicalId;
            dto.disabled = disabled;
            return http("/mandy/medical_disabled", {method: 'put', data: dto, urlencoded: true});
        },

        //启用、禁用设备
        mandy_put_device_disabled: function (deviceId, disabled) {
            var dto = {};
            dto.device_id = deviceId;
            dto.disabled = disabled;
            return http("/mandy/device_disabled", {method: 'put', data: dto});
        },

        //修改医务人员资料
        mandy_put_medical_info: function (medicalId, name, sex, birthday, divisionId, job, roleId, treatmentGroupId) {
            var dto = {};
            dto.medicalId = medicalId;
            dto.name = name;
            dto.sex = sex;
            dto.birthday = birthday;
            dto.divisionId = divisionId;
            dto.job = job;
            dto.roleId = roleId;
            dto.treatmentGroupId = treatmentGroupId;

            return http("/mandy/medical_info", {method: 'put', data: dto});
        },

        //查看个人资料
        mandy_get_profile: function () {
            var dto = {};
            return http("/mandy/profile", {params: dto});
        },

        //查看医务人员资料
        mandy_get_medical_staff: function (medical_staff_id) {
            var dto = {};
            dto.medical_staff_id = medical_staff_id;
            return http("/mandy/medical_staff", {params: dto});
        },

        //查看医务人员列表
        get_medical_staff_list: function () {
            var dto = {};
            return http("/mandy/get_medical_staff_list", {params: dto});
        },

        //查看医生列表
        mandy_get_medical_staff_list: function (types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType) {
            return this.mandy_get_medical_staff_list_by_page(types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, 1, 10000)
        },

        //查看医生列表
        mandy_get_medical_staff_list_by_page: function (types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, page, pageSize) {
            var dto = {};
            if (types != null) {
                dto.types = types;
            }
            dto.hospital_id = hospitalId;
            dto.division_id = divisionId;
            dto.province_id = provinceId;
            dto.city_id = cityId;
            dto.district_id = districtId;
            dto.station = station;
            dto.page = page;
            dto.page_size = pageSize;
            dto.tag_id = tagId;
            dto.sort_type = sortType;
            return http("/mandy/medical_staff_list", {params: dto});
        },

        //获取科室列表
        mandy_get_division_list_syn: function (hospitalId) {
            var dto = {};
            dto.hospital_id = hospitalId;
            return http("/mandy/division_list", {params: dto});
        },

        //获得治疗组列表（同步）
        mandy_get_treatment_group_syn: function () {
            var dto = {};
            return http("/mandy/treatment_group", {params: dto});
        },

        //获得治疗组列表
        mandy_get_treatment_group: function () {
            var dto = {};
            return http("/mandy/treatment_group", {params: dto});
        },

        //获得实习医生导师列表
        mandy_get_treat_group_teacher: function (group_id) {
            var dto = {};
            dto.groupId = group_id;
            return http("/mandy/treat_group_teacher", {params: dto});
        },

        //获取疾病列表
        mandy_get_disease_list: function () {
            var dto = {};
            return http("/mandy/disease_list", {params: dto});
        },

        //获取病种列表
        mandy_get_gauge_list: function (diseaseId) {
            var dto = {};
            dto.disease_id = diseaseId;
            return http("/mandy/gauge_list", {params: dto});
        },

        //查看患者病历信息(根据病历id)
        mandy_get_emr: function (id, referralId, number) {
            var dto = {};
            dto.id = id;
            dto.referral_id = referralId;
            dto.number = number;
            return http("/mandy/emr", {params: dto});
        },

        //查看患者病历信息(根据患者编号)
        mandy_get_emr_by_number_hospitalId: function (number) {
            var dto = {};
            dto.number = number;
            return http("/mandy/emr", {params: dto});
        },


        //新建转诊门诊查看患者信息(根据身份证号)
        mandy_get_emr_by_identity_card: function (identityCard) {
            var dto = {};
            dto.identity_card = identityCard;
            return http("/mandy/match_emr", {params: dto});
        },

        //新建门诊转诊匹配并新建病历
        mandy_post_match_emr: function (referralId, emrId) {
            var dto = {};
            dto.referral_id = referralId;
            dto.emr_id = emrId;
            return http("/mandy/match_emr", {method: 'post', data: dto});
        },

        //新建门诊转诊新建病历
        mandy_post_add_emr: function (dto) {
            var dto = dto;
            return http("/mandy/in_emr", {method: 'post', data: dto});
        },


        //查看医院的患者
        mandy_get_all_emr: function (page, page_size, params) {
            var _params = {
                page: page,
                page_size: page_size
            };
            $.extend(_params, params)
            return http("/mandy/all_emr", {params: _params});
        },

        //查看我的患者
        mandy_get_my_emr: function (page, page_size, params) {
            var _params = {
                page: page,
                page_size: page_size
            };
            $.extend(_params, params)
            return http("/mandy/my_emr", {params: _params});
        },

        //查看我的患者(检查报告)
        mandy_get_my_emr_with_count: function (searchKey, page, page_size) {
            var dto = {};
            dto.page = page;
            dto.page_size = page_size;
            dto.search_key = searchKey;
            return http("/mandy/my_emr_with_count", {params: dto});
        },

        //查看我的患者(治疗方案)
        mandy_get_my_emr_with_able: function (searchKey, page, page_size) {
            var dto = {};
            dto.page = page;
            dto.page_size = page_size;
            dto.search_key = searchKey;
            return http("/mandy/my_emr_with_able", {params: dto});
        },

        //查询转出患者
        mandy_get_out_emr: function (searchKey, page, page_size) {
            var dto = {};
            dto.page = page;
            dto.page_size = page_size;
            dto.search_key = searchKey;
            return http("/mandy/out_emr", {params: dto});
        },

        //查询转入患者
        mandy_get_in_emr: function (searchKey, page, page_size) {
            var dto = {};
            dto.page = page;
            dto.page_size = page_size;
            dto.search_key = searchKey;
            return http("/mandy/in_emr", {params: dto});
        },

        //转出患者
        mandy_post_out_emr: function (EMRId, inHosId, inMedicalId, info, remark, remarkVal) {
            var dto = {};
            dto.outEMRId = EMRId;
            dto.receiveHospitalId = inHosId;
            dto.receiveMedicalId = inMedicalId;
            dto.receiveHosDivAccDTO = info;
            dto.prescribed = remark;
            dto.remark = remarkVal;
            return http("/mandy/out_emr", {method: 'post', data: dto});
        },

        //转诊接收的医生列表
        mandy_get_receive_doctor_list_sync: function (referralId) {
            var dto = {};
            dto.referral_id = referralId;
            return http("/mandy/receive_doctor_list", {params: dto});
        },

        //指定转诊医生
        mandy_put_receive_medical: function (referralId, medicalId) {
            var dto = {};
            dto.referralEmrId = referralId;
            dto.medicalId = medicalId;
            return http("/mandy/receive_medical", {method: 'put', params: dto});
        },

        //添加处方(老)
        mandy_add_prescription: function (type, diagnose, diagnoseRemark, description, EMRId, items) {
            var dto = {};
            dto.type = type;
            dto.diagnose = diagnose;
            dto.diagnose_remark = diagnoseRemark;
            dto.description = description;
            dto.medical_record = {};
            dto.medical_record.id = EMRId;
            dto.prcp_item_list = items;
            return http("/mandy/prescription", {method: 'post', data: dto});
        },

        //增加模板
        mandy_add_template: function (part, content) {
            var dto = {};
            dto.content = content;
            dto.part = part;
            return http("/mandy/add_template", {method: 'post', data: dto});
        },


        //获取模板
        mandy_get_templates: function (part, page, pageSize) {
            var dto = {};
            dto.part = part;
            dto.page = page;
            dto.page_size = pageSize;
            return http("/mandy/get_templates", {params: dto});
        },

        //删除模板
        mandy_delete_template: function (id) {
            var dto = {};
            dto.id = id;
            return http("/mandy/delete_template", {method: 'put', data: dto});
        },

        //新增治疗方案
        mandy_post_training_plan: function (emrId, plan, prcpItemId) {
            var dto = {};
            dto.emr_id = emrId;
            dto.plan = plan;
            dto.prcp_item_id = prcpItemId;
            return http("/mandy/training_plan", {method: 'post', data: dto});
        },

        //分页查询治疗方案
        mandy_get_emr_group_training_plan: function (emrId, is_referral_history, itemType, page, pageSize) {
            var dto = {};
            dto.emr_id = emrId;
            dto.is_referral_history = is_referral_history;
            dto.item_type = itemType;
            dto.page = page;
            dto.page_size = pageSize;
            return http("/mandy/emr_group_training_plan", {params: dto});
        },

        //查询治疗方案总数
        mandy_get_emr_group_training_plan_count: function (emrId, is_referral_history, itemType) {
            var dto = {};
            dto.emr_id = emrId;
            dto.is_referral_history = is_referral_history;
            dto.item_type = itemType;
            return http("/mandy/emr_group_training_plan_count", {params: dto});
        },

        //获取市的行政区域
        mandy_get_district_list: function (cityId) {
            var dto = {};
            dto.city_id = cityId;
            return http("/mandy/district_list", {params: dto});
        },

        //转诊统计
        mandy_get_hospital_referral_stat: function (startTime, endTime) {
            var dto = {};
            dto.start_date = startTime;
            dto.end_date = endTime;
            return http("/mandy/statistics_referral", {params: dto});
        },

        //转诊统计（统计整个系统）
        mandy_get_hospital_referral_stat_admin: function (startTime, endTime) {
            var dto = {};
            dto.start_time = startTime;
            dto.end_time = endTime;
            return http("/mandy/referral_statistics_admin", {params: dto});
        },

        //增加医院
        mandy_add_hospital: function (hospitalDto) {
            var dto = {};
            dto.hospital = hospitalDto;
            return http("/mandy/hospital", {method: 'post', data: dto});
        },

        //获取治疗组成员
        mandy_get_treat_group_members: function (groupId) {
            var dto = {};
            dto.group_id = groupId;
            return http("/mandy/treat_group_members", {params: dto});
        },

        //获取治疗组成员（同步）
        mandy_get_treat_group_members_syn: function () {
            var dto = {};
            return http("/mandy/treat_group_members", {params: dto});
        },

        //查看我的治疗组
        mandy_get_my_treat_group_syn: function () {
            var dto = {};
            return http("/mandy/my_treat_group", {params: dto});
        },

        //根据转诊记录id获取单条转诊记录
        mandy_get_referral_emr: function (id, type) {
            var dto = {};
            dto.referral_emr_id = id;
            dto.medical_type = type;
            return http("/mandy/referral_emr", {params: dto});
        },

        //根据病历ID获取从其他医院转入本医院的转诊记录列表
        mandy_get_referral_emr_list: function (inId) {
            var dto = {};
            dto.in_id = inId;
            return http("/mandy/referral_emr_list", {params: dto});
        },

        //新增病历记录
        mandy_add_clinic: function (diagnoseId, emrId, diseaseId, data, otherInfo, diagnoseRemark) {
            var params = {
                    diagnose_id: diagnoseId,
                    emr_id: emrId,
                    disease_id: diseaseId,
                    diagnose_remark: diagnoseRemark
                },
                _data = {
                    otherInfo: otherInfo,
                };
            $.extend(_data,data);
            return http("/mandy/clinic", {method: 'post', params: params, data: _data});
        },

        //7日内编辑病历记录
        mandy_update_clinic: function (diagnoseId, clinicId, diseaseId, diseaseInfo, otherInfo, diagnoseRemark) {
            var params = {
                    diagnose_id: diagnoseId,
                    clinic_id: clinicId,
                    disease_id: diseaseId,
                    diagnose_remark: diagnoseRemark
                },
                _data = {
                    otherInfo: otherInfo,
                };
            $.extend(_data,data);
            return http("/mandy/update_clinic", {method: 'put', params: params, data: _data});
        },

        //快速转诊的增加病历记录
        mandy_add_clinic2: function (diagnoseId, emrId, diseaseId, diseaseInfo, otherInfo, diagnoseRemark) {
            var dto = {};
            dto.diagnose_id = diagnoseId;
            dto.emr_id = emrId;
            dto.disease_id = diseaseId;
            dto.disease_info = diseaseInfo;
            dto.other_info = diseaseInfo;
            dto.diagnose_remark = diagnoseRemark;
            return http("/mandy/clinic2", {method: 'post', data: dto});
        },

        //接诊医生创建患者病历
        mandy_post_in_emr: function (transferId, emr) {
            var dto = {};
            dto.referral_emr_id = transferId;
            dto.in_emr = emr;
            return http("/mandy/in_emr", {method: 'post', data: dto});
        },

        //医生接诊
        mandy_put_referral_emr: function (referralEmrId, messageId) {
            var dto = {};
            dto.messageId = messageId;
            dto.referralEmrId = referralEmrId;
            return http("/mandy/referral_emr", {method: 'put', params: dto});
        },

        //分页获取治疗师的治疗项目
        mandy_get_my_prescription_item_list: function (searchKey, page, pageSize, type, startDate, prcpType) {
            var dto = {};
            dto.page = page;
            dto.page_size = pageSize;
            dto.type = type;
            dto.start_date = startDate;
            dto.prcp_type = prcpType;
            dto.search_key = searchKey;
            return http("/mandy/my_prescription_item_list", {params: dto});
        },

        //上传检查报告
        mandy_post_inspection_report: function (inspectionReport) {

            return http("/mandy/inspection_report", {method: 'post', data: inspectionReport});
        },

        //查看检查报告
        mandy_get_inspection_report: function (inspectionReportId, emr_id, is_referral_history) {
            var dto = {};
            dto.id = inspectionReportId;
            dto.emr_id = emr_id;
            dto.is_referral_history = is_referral_history;
            return http("/mandy/inspection_report", {params: dto});
        },

        //获取患者的所有评估列表
        mandy_get_gauge_record_by_patient_id: function (status, patientId) {
            var dto = {};
            dto.status = status;
            dto.patient_id = patientId;
            return http("/mandy/gauge_record_by_patient_id", {params: dto});
        },

        //查询某个病历某一个具体的治疗单的所有康复训练方案
        mandy_get_emr_item_training_plan: function (emrId, prcpItemId, page, pageSize) {
            var dto = {};
            dto.emr_id = emrId;
            dto.prcp_item_id = prcpItemId;
            dto.page = page;
            dto.page_size = pageSize;
            return http("/mandy/emr_prcp_item_training_plan", {params: dto});
        },

        //查询某个病历某一个具体的治疗单的所有康复训练方案的总条数
        mandy_get_emr_item_training_plan_count: function (emrId, prcpItemId) {
            var dto = {};
            dto.emr_id = emrId;
            dto.prcp_item_id = prcpItemId;
            return http("/mandy/emr_prcp_item_training_plan_count", {params: dto});
        },

        //查询某个病历各类治疗单中最新的一条康复训练方案
        mandy_get_newest_training_plan: function (emrId, is_referral_history) {
            var dto = {};
            dto.emr_id = emrId;
            dto.is_referral_history = is_referral_history;
            return http("/mandy/newest_training_plan", {params: dto});
        },

        //获取治疗师排班表(上午\下午)
        mandy_get_group_schedule_table: function (groupId, startDate) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_date = startDate;
            return http("/mandy/get_group_schedule_table", {params: dto});
        },

        //获取groupId(各医院的不一样)
        mandy_hos_group_not_in: function () {
            var dto = {};
            return http("/mandy/hos_group_not_in", {params: dto});
        },

        //排班统计一览表_按组统计收费
        mandy_get_group_charges_static: function (groupId, startTime, endTime) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            return http("/mandy/get_group_charges_static", {params: dto});
        },

        //排班统计一览表_饼图统计
        mandy_statistics_patient_prescription_by_group: function (startDate, endDate) {
            var dto = {};
            dto.start_date = startDate;
            dto.end_date = endDate;
            return http("/mandy/statistics_patient_prescription_by_group", {method: 'post', data: dto});
        },

        //排班统计一览表_按组统计次数
        mandy_statistics_patient_prescription_by_therapist: function (groupId, startDate, endDate) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_date = startDate;
            dto.end_date = endDate;
            return http("/mandy/statistics_patient_prescription_by_therapist", {method: 'post', data: dto});
        },

        //转诊统计(按医院等级分组)
        mandy_statistics_referral: function (startDate, endDate) {
            var dto = {};
            dto.start_date = startDate;
            dto.end_date = endDate;
            return http("/mandy/statistics_referral", {method: 'post', data: dto});
        },

        //治疗师人员统计
        mandy_statistics_profile: function (groupId, startDate, endDate) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_date = startDate;
            dto.end_date = endDate;
            return http("/mandy/statistics_profile", {method: 'post', data: dto, urlencoded: true});
        },

        //质控统计整体趋势饼图
        mandy_statistic_new_patient: function (startDate, endDate) {
            var dto = {};
            dto.start_date = startDate;
            dto.end_date = endDate;
            return http("/mandy/statistic_new_patient", {method: 'post', data: dto, urlencoded: true});
        },


        //质控统计治疗师收费饼图
        mandy_get_overall_charges_static: function (startDate, endDate) {
            var dto = {};
            dto.start_time = startDate;
            dto.end_time = endDate;
            return http("/mandy/get_overall_charges_static", {params: dto});
        },

        //质控统计治疗师收费柱状图及列表
        mandy_get_overall_charges_static_detail: function (groupId, startDate, endDate) {
            var dto = {};
            dto.group_id = groupId;
            dto.start_time = startDate;
            dto.end_time = endDate;
            return http("/mandy/get_overall_charges_static_detail", {params: dto});
        },


        //质控统计治疗师收费列表查看详情
        mandy_get_therapist_charges_static: function (therapistId, startDate, endDate) {
            var dto = {};
            dto.therapist_id = therapistId;
            dto.start_time = startDate;
            dto.end_time = endDate;
            return http("/mandy/get_therapist_charges_static", {params: dto});
        },

        //质控统计患者收费
        mandy_get_patient_charges_static: function (searchKey) {
            var dto = {};
            dto.search_key = searchKey;
            return http("/mandy/get_patient_charges_static", {params: dto});
        },

        //转诊统计详情按医院查询
        mandy_statistics_referral_by_medical: function (hospitalId, startDate, endDate) {
            var dto = {};
            dto.hospital_id = hospitalId;
            dto.start_date = startDate;
            dto.end_date = endDate;
            return http("/mandy/statistics_referral_by_medical", {params: dto});
        },


        //转诊统计详情按医院及医生查询
        mandy_statistics_referral_by_patient: function (medicalId, hospitalId) {
            var dto = {};
            dto.medical_id = medicalId;
            dto.hospital_id = hospitalId;
            /*dto.start_date = startDate;
            dto.end_date = endDate;*/
            return http("/mandy/statistics_referral_by_patient", {method: 'post', data: dto});
        },

        //转诊统计详情获取医院列表
        mandy_get_hospitals: function () {
            var dto = {};
            return http("/mandy/hospitals");
        },

        //转诊统计详情根据医院id查该医院的医生
        mandy_get_doctor_staff_list: function (hospitalId) {
            var dto = {};
            dto.hospital_id = hospitalId;
            dto.station = "doctor";
            return http("/mandy/doctor_staff_list", {params: dto});
        },

        //首页存档
        mandy_put_is_save: function (emrId) {
            var dto = {};
            dto.emr_id = emrId;
            return http("/mandy/is_save", {method: 'put', params: dto});
        },


        //转诊历史时间轴
        mandy_get_referral_history: function (emrId) {
            var dto = {};
            dto.emr_id = emrId;
            return http("/mandy/referral_history", {params: dto});
        },

        //获取套餐列表
        mandy_get_package_list: function () {
            var dto = {};
            return http("/mandy/package_list", {params: dto});
        },

        //根据套餐id获取套餐项目
        mandy_get_prescriptionSubitem_by_pid: function (pid) {
            var dto = {};
            dto.pid = pid;
            return http("/mandy/get_prescriptionSubitem_by_pid", {params: dto});
        },


        //根据套餐类型获取治疗师列表
        mandy_get_therapist_by_typeId: function (typeId) {
            var dto = {};
            dto.typeId = typeId;
            return http("/mandy/get_therapist_by_typeId", {params: dto});
        },

        //添加套餐或训练处方
        mandy_post_add_package_prescription: function (isPackage, result) {
            var dto = {};
            dto.train = result;
            dto.train.isPackage = isPackage;
            dto.isPackage = isPackage;
            return http("/mandy/add_prescription", {method: 'post', data: dto});
        },

        //增加项目管理
        mandy_post_add_subitem: function (type_id, itemName, itemCode, unitFee, is_use, treat_time) {
            var dto = {};
            dto.typeId = type_id;
            dto.itemName = itemName;
            dto.itemCode = itemCode;
            dto.unitFee = unitFee;
            dto.isUse = is_use;
            dto.treatTime = treat_time;
            return http("/mandy/add_subitem", {method: 'post', data: dto});
        },

        //获取项目列表
        mandy_get_subitem_list_by_page: function (searchKey, typeId, page, pageSize) {
            var dto = {};
            dto.searchKey = searchKey;
            dto.typeId = typeId;
            dto.page = page;
            dto.pageSize = pageSize;
            return http("/mandy/get_subitem", {params: dto});
        },

        //查看单条项目信息
        mandy_get_subitem_by_id: function (id) {
            var dto = {};
            dto.id = id;
            return http("/mandy/get_subitem_by_id", {params: dto});
        },

        //修改项目管理
        mandy_update_subitem: function (id, typeId, type, itemName, itemCode, isUse, unitFee, treat_time) {
            var dto = {};
            dto.id = id;
            dto.typeId = typeId;
            dto.type = type;
            dto.itemName = itemName;
            dto.itemCode = itemCode;
            dto.unitFee = unitFee;
            dto.treatTime = treat_time;
            dto.isUse = isUse;
            return http("/mandy/update_subitem", {method: 'post', data: dto});
        },

        //启用禁用项目
        mandy_update_subitem_disabled: function (id, disabled) {
            var dto = {};
            dto.id = id;
            dto.disabled = disabled;
            return http("/mandy/update_subitem_disabled", {method: 'post', data: dto});
        },

        //获取项目管理处方类别和设备管理设备类别
        mandy_get_prescriptionType_syn: function () {
            var dto = {};
            return http("/mandy/get_prescriptionType", {params: dto});
        },

        //患者收费明细
        mandy_get_patient_charges_static_detail: function (patient_id, start_time, end_time) {
            var dto = {};
            dto.patient_id = patient_id;
            dto.start_time = start_time;
            dto.end_time = end_time;
            return http("/mandy/get_patient_charges_static_detail", {params: dto});
        },


        /*****************未知*********************/
        //获取量表列表???
        mandy_get_gauge_record: function (gaugeRecordId, prcpItemId) {
            var dto = {};
            dto.gauge_record_id = gaugeRecordId;
            dto.prcp_item_id = prcpItemId;
            return http("/mandy/gauge_record", {params: dto});
        },

        //查询可添加训练方案的最新的一个治疗单
        mandy_get_newest_prcp_item: function (emrId) {
            var dto = {};
            dto.emr_id = emrId;
            return http("/mandy/newest_prcp_item", {params: dto});
        },

        //根据id获取某个具体的治疗单
        mandy_get_prescription_item: function (prcp_item_id) {
            var dto = {};
            dto.prcp_item_id = prcp_item_id;
            return http("/mandy/prescription_item", {params: dto});
        },

        //查看治疗记录
        mandy_get_treatment_record_list: function (page, pageSize, params) {
            var _params = {
                page: page,
                page_size: pageSize
            };
            $.extend(_params, params)
            return http("/mandy/treatment_record_list", {params: _params});
        },

        //重新评估
        mandy_post_gauge_record_re_evaluation: function (prcpItemId, result) {
            var params = {
                prcp_item_id: prcpItemId
            };
            return http("/mandy/gauge_record_re_evaluation", {method: 'post', params: params, data: result});
        },

        //病历记录分页查询
        mandy_get_clinic_list: function (emrId, is_referral_history, page, pageSize) {
            var dto = {};
            dto.is_referral_history = is_referral_history;
            dto.emr_id = emrId;
            dto.page = page;
            dto.page_size = pageSize;
            return http("/mandy/emr_clinic_list", {params: dto});
        },

        /**
         * @author: ares
         * @date: 2019/3/21 9:55
         * @description: 查询会诊记录
         * @param {string}emrId
         * @param {number}page
         * @param {number}pageSize
         */
        mandy_get_consultation_list: function (emrId, page, pageSize) {
            var params = {
                emr_id: emrId,
                page: page,
                page_size: pageSize
            };
            return http("/mandy/consultation_list", {params: params});
        },

        /**
         * @author: ares
         * @date: 2019/3/21 15:30
         * @description: 获取会诊详情
         * @param {string}id    会诊id
         */
        mandy_get_consultation_detail: function (id) {
            var params = {
                id: id
            };
            return http("/mandy/consultation", {params: params});
        },

        //获取检查报告列表
        mandy_get_inspection_report_list: function (patientId, emr_id, is_referral_history) {
            var dto = {};
            dto.patient_id = patientId;
            dto.emr_id = emr_id;
            dto.is_referral_history = is_referral_history;
            return http("/mandy/inspection_report_list", {params: dto});
        },

        //分页查询检查报告
        mandy_get_inspection_report_list_by_page: function (patientId, page, pageSize) {
            var dto = {};
            dto.patient_id = patientId;
            dto.page = page;
            dto.page_size = pageSize;
            return http("/mandy/inspection_report_list_by_page", {params: dto});
        },

        //获得病历记录
        mandy_get_clinic: function (id, emr_id, is_referral_history) {
            var dto = {};
            dto.id = id;
            dto.emr_id = emr_id;
            dto.is_referral_history = is_referral_history;
            return http("/mandy/clinic", {params: dto});
        },

        //获取该患者下同种评估类型的列表
        mandy_get_gauge_record_by_prcp_item_id: function (prcpItemId) {
            var dto = {};
            dto.prcp_item_id = prcpItemId;
            return http("/mandy/gauge_record_by_prcp_item_id", {params: dto});
        },

        //根据id获取治疗记录
        mandy_get_treatment_record: function (recordId) {
            var dto = {};
            dto.record_id = recordId;
            return http("/mandy/treatment_record", {params: dto});
        },

        //查看治疗记录个数
        mandy_get_treatment_record_count: function (emrId, is_referral_history, itemType, itemId) {
            var dto = {};
            dto.emr_id = emrId;
            dto.is_referral_history = is_referral_history;
            dto.item_type = itemType;
            dto.item_id = itemId;
            return http("/mandy/treatment_record_count", {params: dto});
        },

        //获取最新的治疗记录
        mandy_get_newest_treatment_records: function (emrId, is_referral_history) {
            var dto = {};
            dto.emr_id = emrId;
            dto.is_referral_history = is_referral_history;
            return http("/mandy/newest_treatment_records", {params: dto});
        },

        //删除治疗记录
        mandy_delete_treatment_record: function (id) {
            var dto = {};
            dto.id = id;
            return http("/mandy/treatment_record", {method: 'delete', data: dto});
        },

        //查询治疗单对应的最新的一条康复训练方案
        mandy_get_item_newest_training_plan: function (itemIds) {
            var dto = {};
            dto.item_ids = itemIds;
            return http("/mandy/item_newest_training_plan", {params: dto});
        },

        /********治疗师接口*/
        //对康复训练的确认完成
        mandy_put_treatment_record_status: function (treatmentRecordId, condition, status) {
            var dto = {};
            dto.record_id = treatmentRecordId;
            dto.condition = condition;
            dto.status = status;
            return http("/mandy/treatment_record_status", {method: 'put', data: dto});
        },

        //治疗师取消/修改排班
        mandy_put_therapist_schedule: function (prescriptionItemId, therapistId, patientId, timeList, recordIdList) {
            var dto = {};
            dto.prescription_item_id = prescriptionItemId;
            dto.therapist_id = therapistId;
            dto.patient_id = patientId;
            dto.time_block_list = timeList;
            dto.record_id_list = recordIdList;
            return http("/mandy/therapist_schedule", {method: 'put', data: dto});
        },

        //分页获取治疗师的治疗项目
        mandy_get_group_prescription_item_list: function (searchKey, status, page, pageSize) {
            var dto = {};
            dto.status = status;
            dto.page = page;
            dto.page_size = pageSize;
            dto.search_key = searchKey;
            return http("/mandy/group_prescription_item_list", {params: dto});
        },

        //治疗师添加排班
        mandy_post_therapist_schedule: function (prescriptionItemId, therapistId, weeks, timeList) {
            var dto = {};
            dto.prescription_item_id = prescriptionItemId;
            dto.therapist_id = therapistId;
            dto.weeks = weeks;
            dto.time_block_list = timeList;
            return http("/mandy/therapist_schedule", {method: 'post', data: dto});
        },

        //获取某天某治疗师的排班信息
        mandy_get_therapist_schedule: function (therapistId, date) {
            var dto = {};
            dto.therapist_id = therapistId;
            dto.date = date;
            return http("/mandy/therapist_schedule", {params: dto});
        },

        //获取某天某治疗师可排班的时间段
        mandy_get_therapist_schedule_period: function (therapistId, emrId, date) {
            var dto = {};
            dto.therapist_id = therapistId;
            dto.emr_id = emrId;
            dto.date = date;
            return http("/mandy/schedule_period", {params: dto});
        },

        //治疗师获取治疗过的患者的病历列表
        mandy_get_therapist_emr_by_page: function (searchKey, page, page_size) {
            var dto = {};
            dto.page = page;
            dto.page_size = page_size;
            dto.search_key = searchKey;
            return http("/mandy/therapist_emr_by_page", {params: dto});
        },

        //治疗师获取我的治疗记录
        mandy_get_therapist_treatment_record_by_page: function (searchKey, page, page_size, status) {
            var dto = {};
            dto.current_page = page;
            dto.page_size = page_size;
            dto.status = status;
            dto.search_key = searchKey;
            return http("/mandy/therapist_treatment_record_by_page", {params: dto});
        },

        //治疗师获取我的治疗记录并获得是否做过治疗安排
        mandy_get_therapist_plan_treatment_record_by_page: function (searchKey, page, page_size, status) {
            var dto = {};
            dto.current_page = page;
            dto.page_size = page_size;
            dto.status = status;
            dto.search_key = searchKey;
            return http("/mandy/therapist_plan_treatment_record_by_page", {params: dto});
        },

        //获取最旧的治疗小结
        mandy_get_oldest_treatment_summary: function (itemId) {
            var dto = {};
            dto.item_id = itemId;
            return http("/mandy/oldest_treatment_summary", {params: dto});
        },

        //获取假期
        mandy_get_vacation: function (therapistId, groupId, startTime, endTime) {
            var dto = {};
            //dto.therapist_id = therapistId;
            dto.group_id = groupId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            return http("/mandy/vacation", {params: dto});
        },

        //增加假期
        mandy_add_vacation: function (medicalId, remark, isLoop, startTime, endTime) {
            var dto = {};
            //dto.therapist_id = therapistId;
            dto.medical_id = medicalId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            dto.remark = remark;
            dto.is_loop = isLoop;
            return http("/mandy/vacation", {method: 'post', data: dto});
        },

        //删除假期
        mandy_delete_vacation: function (vacationId) {
            var dto = {};
            dto.vacation_id = vacationId;
            return http("/mandy/vacation", {method: 'delete', data: dto});
        },

        //修改假期
        mandy_put_vacation: function (vacationId, remark, isLoop, startTime, endTime) {
            var dto = {};
            dto.vacation_id = vacationId;
            dto.start_time = startTime;
            dto.end_time = endTime;
            dto.remark = remark;
            dto.is_loop = isLoop;
            return http("/mandy/vacation", {method: 'put', data: dto});
        },

        //治疗师长获取本组某段时间的排班情况
        mandy_get_therapist_group_schedule_periods: function (startDate, endDate) {
            var dto = {};
            dto.start_date = startDate;
            dto.end_date = endDate;
            return http("/mandy/therapist_group_schedule_periods", {params: dto});
        },

        //治疗师获取我的治疗记录数量
        mandy_get_therapist_treatment_record_count: function (searchKey, status) {
            var dto = {};
            dto.status = status;
            dto.search_key = searchKey;
            return http("/mandy/therapist_treatment_record_count", {params: dto});
        },

        //治疗师获取我的治疗记录
        mandy_get_therapist_plan_treatment_record_count: function (searchKey, status) {
            var dto = {};
            dto.status = status;
            dto.search_key = searchKey;
            return http("/mandy/therapist_plan_treatment_record_count", {params: dto});
        },

        //治疗师获取一段时间的排班（一般是一周）
        mandy_get_therapist_schedule_periods: function (therapistId, startDate, endDate) {
            var dto = {};
            dto.therapist_id = therapistId;
            dto.start_date = startDate;
            dto.end_date = endDate;
            return http("/mandy/therapist_schedule_periods", {params: dto});
        },

        //修改治疗师
        mandy_set_pcrp_item_therapist: function (prcp_item_id, therapist_id) {
            var dto = {};
            dto.therapist_id = therapist_id;
            dto.prcp_item_id = prcp_item_id;
            return http("/mandy/prcp_item_therapist", {method: 'put', data: dto});
        },
        //我的住院患者
        mandy_get_my_inpatient: function () {
            return http("/mandy/my_inpatient");
        },
    }

    exports("mandyServices", mandyServices);
})